/**
 * Author@ Cheng Feitian
 * Date: 2020-3-17
 * Description: 
 * Input Format: 
 * Output Format: 
 */

#include <stdio.h>

#define SUCCESS 0;
#define FAILED -1;

int compute(int *a, int N, int capacity);

int main(void)
{
    /* 初始化 */
    int N;
    int status = FAILED;
    if (scanf("%d", &N) != EOF)
    {
        if (N >= 1 && N <= 1000)
        {
            int a[N];
            int capacity = 0;
            int result = 0;
            for (int i = 0; i < N; i++)
            {
                if ((scanf("%d", &a[i]) != EOF) && a[i] >= 1 && a[i] <= 1000)
                    status = SUCCESS;
            }
            if (scanf("%d", &capacity) != EOF)
            {
                if (capacity >= 1 && capacity <= 1000)
                {
                    result = compute(a, N, capacity);
                    printf("%d\n", result);
                }
                else
                    status = FAILED;
            }
        }
        else
            status = FAILED;
    }
    return status;
}

int compute(int *a, int N, int capacity)
{
    int result = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = N - 1; j > i; j--)
        {
            if (capacity == (a[i] + a[j]))
            {
                result++;
            }
        }
    }

    return result;
}
